﻿namespace = can_aus

# Canadian colony absorbs a poorer neighbor
can_aus.1 = {
	type = country_event
	placement = ROOT

	title = can_aus.1.t
	desc = can_aus.1.d
	flavor = can_aus.1.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		random_neighbouring_state = {
			limit = {
				owner = {
					is_ai = yes
					relations:root >= relations_threshold:amicable
					OR = {
						country_has_primary_culture = cu:anglo_canadian
						country_has_primary_culture = cu:franco_canadian
					}
					is_subject = yes
					NOT = { THIS = ROOT }
					top_overlord = {
						THIS = root.top_overlord
					}
					this.gdp < root.gdp
				}
			}
			owner = { save_scope_as = canada_annex_scope }
		}
		top_overlord = {
			save_scope_as = canada_overlord_country
			ruler = {
				save_scope_as = canada_overlord_ruler
			}
		}
	}

	option = {
		name = can_aus.1.a
		default_option = yes

		every_country = {
			limit = {
				is_subject_of = scope:canada_annex_scope
			}
			save_scope_as = subject_of_subject

			scope:canada_annex_scope = {
				top_overlord = {
					create_diplomatic_pact = {
						country = scope:subject_of_subject
						type = puppet
					}
				}
			}
		}
		annex = scope:canada_annex_scope
	}
}

# Britain mashes 2 Canadians together
can_aus.2 = {
	type = country_event
	placement = ROOT

	title = can_aus.2.t
	desc = can_aus.2.d
	flavor = can_aus.1.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		random_subject_or_below = {
			limit = {
				OR = {
					country_has_primary_culture = cu:anglo_canadian
					country_has_primary_culture = cu:franco_canadian
				}
				relations:root >= relations_threshold:amicable
				is_ai = yes
			}
			save_scope_as = canada_scope_1
		}
		random_subject_or_below = {
			limit = {
				OR = {
					country_has_primary_culture = cu:anglo_canadian
					country_has_primary_culture = cu:franco_canadian
				}
				relations:root >= relations_threshold:amicable
				is_ai = yes
				NOT = {
					scope:canada_scope_1 = THIS
				}
			}
			save_scope_as = canada_scope_2
		}
	}

	option = {
		name = can_aus.2.a
		default_option = yes
		if = {
			limit = {
				scope:canada_scope_1.gdp > scope:canada_scope_2.gdp
			}
			scope:canada_scope_1 = {
				every_country = {
					limit = {
						is_subject_of = scope:canada_scope_2
					}
					save_scope_as = subject_of_subject

					scope:canada_scope_2 = {
						top_overlord = {
							create_diplomatic_pact = {
								country = scope:subject_of_subject
								type = puppet
							}
						}
					}
				}
				annex = scope:canada_scope_2
			}
		}
		else = {
			scope:canada_scope_2 = {
				every_country = {
					limit = {
						is_subject_of = scope:canada_scope_1
					}
					save_scope_as = subject_of_subject

					scope:canada_scope_1 = {
						top_overlord = {
							create_diplomatic_pact = {
								country = scope:subject_of_subject
								type = puppet
							}
						}
					}
				}
				annex = scope:canada_scope_1
			}
		}
	}
}

# Australian colony absorbs a poorer neighbor
can_aus.3 = {
	type = country_event
	placement = ROOT

	title = can_aus.1.t
	desc = can_aus.3.d
	flavor = can_aus.3.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		random_neighbouring_state = {
			limit = {
				owner = {
					is_ai = yes
					relations:root >= relations_threshold:amicable
					OR = {
						country_has_primary_culture = cu:australian
						country_has_primary_culture = cu:maori
					}
					is_subject = yes
					NOT = { THIS = ROOT }
					top_overlord = {
						THIS = root.top_overlord
					}
					this.gdp < root.gdp
				}
			}
			owner = { save_scope_as = canada_annex_scope }
		}
		top_overlord = {
			save_scope_as = canada_overlord_country
			ruler = {
				save_scope_as = canada_overlord_ruler
			}
		}
	}

	option = {
		name = can_aus.1.a
		default_option = yes
		annex = scope:canada_annex_scope
	}
}

# Britain mashes 2 Australians together
can_aus.4 = {
	type = country_event
	placement = ROOT

	title = can_aus.2.t
	desc = can_aus.4.d
	flavor = can_aus.3.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		ruler = {
			save_scope_as = australia_overlord_ruler
		}
		random_subject_or_below = {
			limit = {
				OR = {
					country_has_primary_culture = cu:australian
					country_has_primary_culture = cu:maori
				}
				relations:root >= relations_threshold:amicable
				is_ai = yes
			}
			save_scope_as = canada_scope_1
		}
		random_subject_or_below = {
			limit = {
				OR = {
					country_has_primary_culture = cu:australian
					country_has_primary_culture = cu:maori
				}
				relations:root >= relations_threshold:amicable
				NOT = {
					scope:canada_scope_1 = THIS
				}
				is_ai = yes
			}
			save_scope_as = canada_scope_2
		}
	}

	option = {
		name = can_aus.2.a
		default_option = yes
		if = {
			limit = {
				scope:canada_scope_1.gdp > scope:canada_scope_2.gdp
			}
			scope:canada_scope_1 = {
				annex = scope:canada_scope_2
			}
		}
		else = {
			scope:canada_scope_2 = {
				annex = scope:canada_scope_1
			}
		}
	}
}

# Canada complete event for Canada
can_aus.5 = {
	type = country_event
	placement = ROOT

	title = can_aus.5.t
	desc = can_aus.5.d
	flavor = can_aus.5.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		top_overlord = {
			save_scope_as = canada_overlord_country
		}
	}

	option = {
		name = can_aus.5.a
		add_modifier = {
			name = can_unified_canada
			months = normal_modifier_time
		}
		if = {
			limit = {
				NOT = { is_subject_type = subject_type_dominion }
			}
			change_subject_type = subject_type_dominion
		}
	}
}

# Canada complete event for Overlord
can_aus.6 = {
	type = country_event
	placement = ROOT

	title = can_aus.5.t
	desc = can_aus.6.d
	flavor = can_aus.5.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		random_subject_or_below = {
			limit = {
				OR = {
					country_has_primary_culture = cu:anglo_canadian
					country_has_primary_culture = cu:franco_canadian
				}
				any_scope_state = {
					OR = {
						state_region = s:STATE_ONTARIO
						state_region = s:STATE_NEW_BRUNSWICK
						state_region = s:STATE_QUEBEC
						state_region = s:STATE_NEWFOUNDLAND
						state_region = s:STATE_ALBERTA
						state_region = s:STATE_BRITISH_COLUMBIA
						state_region = s:STATE_SASKATCHEWAN
						state_region = s:STATE_MANITOBA
						state_region = s:STATE_YUKON_TERRITORY
						state_region = s:STATE_NORTHWEST_TERRITORIES
						state_region = s:STATE_NUNAVUT
					}
					count >= 9
				}
			}
			save_scope_as = canada_country
		}
	}

	option = {
		name = can_aus.5.a
		add_modifier = {
			name = gbr_unified_canada
			months = normal_modifier_time
		}
	}
}

# Australia complete event for Australia
can_aus.7 = {
	type = country_event
	placement = ROOT

	title = can_aus.7.t
	desc = can_aus.7.d
	flavor = can_aus.7.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		top_overlord = {
			save_scope_as = canada_overlord_country
			ruler = {
				save_scope_as = canada_overlord_ruler
			}
		}
	}

	option = {
		name = can_aus.7.a
		add_modifier = {
			name = aus_unified_australia
			months = normal_modifier_time
		}
		if = {
			limit = {
				NOT = { is_subject_type = subject_type_dominion }
			}
			change_subject_type = subject_type_dominion
		}
	}
}

# Australia complete event for Overlord
can_aus.8 = {
	type = country_event
	placement = ROOT

	title = can_aus.7.t
	desc = can_aus.8.d
	flavor = can_aus.7.f

	event_image = {
		video = "gfx/event_pictures/unspecific_signed_contract.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/signed_contract"

	icon = "gfx/interface/icons/event_icons/event_map.dds"

	duration = 3

	trigger = {
	}

	immediate = {
		random_subject_or_below = {
			limit = {
				OR = {
					country_has_primary_culture = cu:australian
					country_has_primary_culture = cu:maori
				}
				any_scope_state = {
					OR = {
						state_region = s:STATE_NEW_SOUTH_WALES
						state_region = s:STATE_VICTORIA
						state_region = s:STATE_TASMANIA
						state_region = s:STATE_QUEENSLAND
						state_region = s:STATE_SOUTH_AUSTRALIA
						state_region = s:STATE_WESTERN_AUSTRALIA
						state_region = s:STATE_NORTHERN_TERRITORY
						state_region = s:STATE_NORTH_ISLAND
						state_region = s:STATE_SOUTH_ISLAND
					}
					count >= 7
				}
			}
			save_scope_as = canada_country
			ruler = {
				save_scope_as = canada_country_ruler
			}
		}
	}

	option = {
		name = can_aus.7.a
		add_modifier = {
			name = gbr_unified_australia
			months = normal_modifier_time
		}
	}
}
